/**
 * Copyright (c) 2010 icer He <icerhe@gmail.com>
 */
package me.linkcn.ydtxl.client.util;

import android.content.Context;
import android.database.Cursor;
import android.provider.ContactsContract.Groups;
import me.linkcn.ydtxl.client.R;
import me.linkcn.ydtxl.client.sync.object.Group;

/**
 * @author icer.He
 *
 */
public class ContactHelper {
	
	public static Group getGroup(Cursor cursor) {
		Group g = new Group();
		g.set_id(cursor.getInt(cursor.getColumnIndex(Groups._ID)));
		g.setTitle(cursor.getString(cursor.getColumnIndex(Groups.TITLE)));
		g.setVersion(cursor.getInt(cursor.getColumnIndex(Groups.VERSION)));
		return g;
	}
	
	/**
	 * "全部联系人"组
	 * @return
	 */
	public static Group getAllGroup(Context c) {
		Group g = new Group();
		g.set_id(0);
		g.setTitle(c.getResources().getString(R.string.all_group_title));
		return g;
	}
}
